package ui.scene.battle
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	import globals.Global;

	/**
	 * 战斗场景的技能。
	 * @author luguobin
	 */
	public class SkillItem extends Sprite
	{
		private var _bg:Bitmap;
		private var _frame:Bitmap; //框

		public function SkillItem()
		{
			addChildren();
		}

		private function addChildren():void
		{
			_bg = new Bitmap(Global.assetsManager.getAssetsAsBitmapData("battle_skill_bg"));
			_bg.x = 15;
			_bg.y = 10;
			this.addChild(_bg);
			_frame = new Bitmap(Global.assetsManager.getAssetsAsBitmapData("battle_skill_frame_default"));
			this.addChild(_frame);
			this.addEventListener(MouseEvent.MOUSE_OVER, mouseHandler);
			this.addEventListener(MouseEvent.ROLL_OUT, mouseHandler);
		}

		private function mouseHandler(event:MouseEvent):void
		{
			if(event.type == MouseEvent.MOUSE_OVER)
			{
				_frame.bitmapData = Global.assetsManager.getAssetsAsBitmapData("battle_skill_frame_over");
			}
			else if(event.type == MouseEvent.ROLL_OUT)
			{
				_frame.bitmapData = Global.assetsManager.getAssetsAsBitmapData("battle_skill_frame_default");
			}
		}

		public function update():void
		{

		}

		public function clear():void
		{
			_bg.bitmapData = Global.assetsManager.getAssetsAsBitmapData("battle_skill_bg");
		}
	}
}